#include <bits/stdc++.h>
// 2025/03/20
// tag: 
// Author: Forever
using namespace std;
using int64 = int64_t;
#pragma GCC -Ofast

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt", "w", stdout);
    int t;
    cin >> t;
    while (t--){
        int n, k;
        cin >> n >> k;
        if (k & 1){
            for (int i = 1; i < n; i++)
                cout << n << " ";
            cout << n - 1 << endl;
        }
        else{
            for (int i = 1; i < n - 1; i++)
                cout << n - 1 << " ";
            cout << n << " " << n - 1 << endl;
        }
    }
    return 0;
}